from PIL import Image, ImageDraw, ImageFont
import os
import sys

'''
将你的 QQ 头像（或者微博头像）右上角加上红色的数字，
类似于微信未读信息数量那种提示效果。 
'''
def main():
  dir = os.path.dirname(sys.argv[0])
  p = os.path.join(dir, 'head.png')
  image = Image.open(p)
  draw = ImageDraw.Draw(image)
  font = ImageFont.truetype('arial.ttf', 17)
  draw.text((image.size[0] - 12, 1), '6', font=font, fill=(255, 0, 0))
  image.save(os.path.join(dir, 'head2.png'), 'png')
  print('draw finished')


if __name__ == "__main__":
  main()